package bhbt.controller.admin.sys;


import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import bhbt.controller.core.BaseController;
import bhbt.model.Qq;
import bhbt.service.QqService;
import bhbt.utils.MapUtil;






/**
 * Created by Administrator on 2016/3/25.
 */
@Controller
 
public class QqShowController extends BaseController {
    @Resource
    private QqService qqService;
   
   

    @RequestMapping("admin/sys/qqShow.shtml")
    public String show(HttpServletRequest request) throws Exception{
        Map formMap = getParameterMap(request);
        int id = MapUtil.getIntValue(formMap, "id");
        if(0 < id){
        	Qq qq = qqService.getByKey(id);
           
            request.setAttribute("qq",qq);
        }
        return "admin/sys/qqShow";
       
    }
    
    
    @RequestMapping("admin/sys/qqUpdate.shtml")
    public String update(Qq qq,HttpServletRequest request, ModelMap model) throws Exception{
        Map formMap = getParameterMap(request);
        int id = MapUtil.getIntValue(formMap, "id");
       
        if(0 < id){
        	 
        	qqService.update(qq);
            setMessage(model,"修改成功！");
            Boolean result = true;
    		request.setAttribute("result", result);
            request.setAttribute("qq",qq);
            
        }
        return "admin/sys/qqShow";
    }

     
    

}
